<!DOCTYPE html>
<html>
  <head>
    <title>日语单词 - icedata</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <br />
    <br />

    <div id="app">
      <p id="title-text">{{ title }}</p>
      <p id="kanji-text">{{ kanji }}</p>
      <input
        id="input-text"
        type="text"
        ref="inputTextRef"
        v-model="inputText"
        @keydown.enter="handleClick()"
        aria-label="输入文本"
      />

      <br />

      <div class="button-container">
        <button
          class="char-button"
          v-for="(char, index) in charList"
          :key="index"
          @click="handleCharButton(char)"
        >
          {{ char }}
        </button>
      </div>

      <br />
      <button class="normal-button" id="submit-button" @click="handleClick()">
        サブミット
      </button>
      <p id="result-text">{{ result }}</p>
      <p id="rate-text">{{ rate }}</p>

      <!-- 使用v-if指令根据showModal的值来控制是否显示浮层 -->
      <div class="overlay" v-if="showModal">
        <div class="modal">
          <p id="option-text">ユニットを選択してください</p>
          <select class="normal-select" v-model="selectedUnit">
            <option v-for="unit in courseUnits" :key="unit.unitId" :value="unit.unitId">
              {{ unit.unitName }}
            </option>
          </select>
          <br />
          <button class="normal-button" @click="closeModal">確認</button>
        </div>
      </div>
    </div>

    <script src="./main.js"></script>
  </body>
</html>
